package common.wind;

public class WindData {

	public static final String N = "N";
	public static final String NNE = "NNE";
	public static final String NE = "NE";
	public static final String ENE = "ENE";
	public static final String E = "E";
	public static final String ESE = "ESE";
	public static final String SE = "SE";
	public static final String SSE = "SSE";
	public static final String S = "S";
	public static final String SSO = "SSO";
	public static final String SO = "SO";
	public static final String OSO = "OSO";
	public static final String O = "O";
	public static final String ONO = "ONO";
	public static final String NO = "NO";
	public static final String NNO = "NNO";
	public static final String TREND_UP = "U";
	public static final String TREND_DOWN = "D";
	public static final String TREND_STABLE = "S";


	
	private WindDateTime windDateTime;
	private Integer speed;
	private String direction;
	private Integer maxspeed;
	private Integer avgspeed;
	private String trend;
	private boolean isOK;

	public WindData() {
		isOK = true;
	}

	public WindDateTime getWindDateTime() {
		return windDateTime;
	}

	public Integer getSpeed() {
		return speed;
	}

	public String getDirection() {
		return direction;
	}

	public Integer getMaxspeed() {
		return maxspeed;
	}

	public Integer getAvgspeed() {
		return avgspeed;
	}

	public boolean isOK() {
		return isOK;
	}

	public void setWindDateTime(String windDate, String windTime) {
		try {
			this.windDateTime = new WindDateTime(windDate, windTime);
		} catch (Exception e) {
			isOK = false;
		}
	}

	public void setSpeed(String speed) {
		try {
			this.speed = new Integer(speed);
		} catch (Exception e) {
			isOK = false;
		}
	}

	public void setDirection(String direction) {
		this.direction = direction;
		if (this.direction == null)
			isOK = false;
	}

	public void setMaxspeed(String maxspeed) {
		try {
			this.maxspeed = new Integer(maxspeed);
		} catch (Exception e) {
			isOK = false;
		}
	}

	public void setAvgspeed(String avgspeed) {
		try {
			this.avgspeed = new Integer(avgspeed);
		} catch (Exception e) {
			isOK = false;
		}
	}
	
	public String toString(){
		return this.windDateTime.toString() + "-> avg: " + this.avgspeed.toString() + " - " + this.trend;
		
	}

	public String getTrend() {
		return trend;
	}

	public void setTrend(String trend) {
		this.trend = trend;
	}

}
